@version=5

indicator('Pull-Back Scalping Signals', shorttitle=' Pull-Back Scalping Signals ', overlay=true)
start = input.float(title='Start', step=0.00005, defval=0.0134)
increment = input.float(title='Increment', step=0.00005, defval=0.)
maximum = input.float(title='Maximum', step=0.01, defval=0.21)
width = input.int(title='Point Width', minval=1, defval=20)
highlightStartPoints = input(title='Highlight Start Points ', defval=true)

Curly_Fries = input(150, title='Fast')

EmaClD   = input.bool(true, title=Show TPSL Points, tooltip=Show TP  Stop Loss Points)

Popeyes = input(200, title='Medium')
Chicken_Sandwich = input(250, 'Slow')
ema_150 = ta.ema(close, Curly_Fries)
ema_200 = ta.ema(close, Popeyes)
ema_250 = ta.ema(close, Chicken_Sandwich)
a = plot(ema_150, transp=100)
b = plot(ema_200, transp=100)
c = plot(ema_250, transp=100)
up = ema_150  ema_250
down = ema_150  ema_250
mycolor = up and EmaClD   color.rgb(0, 255, 234, 71)  down and EmaClD  color.rgb(255, 12, 32, 72)  na

fill(a, c, color=mycolor, transp=70)


psar = ta.sar(start, increment, maximum)
dir = psar  close  1  -1

psarColor = psar  close  color.rgb(6, 197, 255)  color.rgb(255, 0, 0)


plotshape(dir == 1 and dir[1] == -1 and highlightStartPoints  psar and up  na, title='Buy', style=shape.labelup, location=location.belowbar, size=size.normal, text='Buy', textcolor=color.white, color=color.rgb(6, 197, 255), transp=0)
plotshape(dir == -1 and dir[1] == 1 and highlightStartPoints  psar and down  na, title='Sell', style=shape.labeldown, location=location.abovebar, size=size.normal, text='Sell', textcolor=color.white, color=color.rgb(255, 0, 0), transp=0)

barcolor(dir == 1  color.rgb(6, 197, 255)  color.rgb(255, 0, 0))
Buy = psar  close  1  na
Sell = psar  close  na  -1

changeCond = dir != dir[1]
alertcondition(dir == 1 and dir[1] == -1 and highlightStartPoints  psar  na, title='Buy', message='buy!')
alertcondition(dir == 1 and dir[1] == -1 and highlightStartPoints  psar  na, title='Buy', message='buy!')
alertcondition(dir == 1 and dir[1] == -1 and highlightStartPoints  psar  na, title='Buy', message='buy!')
alertcondition(dir == -1 and dir[1] == 1 and highlightStartPoints  psar  na, title='Sell', message='sell!')

ema1 = input.int(8, minval=1, maxval=300, title='EMA UpTrend')
ema2 = input.int(20, minval=1, maxval=300, title='EMA UpTrend')

shema = input(true, title='Show EMA Trend is Based On')
usedEma1 = ta.ema(close, ema1)
usedEma2 = ta.ema(close, ema2)
col1 = hlc3 = usedEma1  color.rgb(6, 197, 255)  hlc3  usedEma1  color.rgb(255, 0, 0)  color.white
col2 = hlc3 = usedEma2  color.rgb(6, 197, 255)  hlc3  usedEma2  color.rgb(255, 0, 0)  color.white
plot(shema and usedEma1  usedEma1  na, title='EMA', style=plot.style_line, linewidth=2, color=col1)
plot(shema and usedEma2  usedEma2  na, title='EMA', style=plot.style_line, linewidth=2, color=col2)

